package com.yu.es.test;

import com.yu.es.test.utils.ConnectElasticsearch;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

public class HelloES {
    public static void main(String[] args) {
        // 创建客户端对象
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost", 9200, "http")));
        // ...
        System.out.println(client);
        // 关闭客户端连接
    }

    void test() {
        ConnectElasticsearch.connect(client -> {
            // do something
        });
    }
}
